# Copyright 2023 Ant Group Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("//bazel:serving.bzl", "serving_cc_library", "serving_cc_test")

package(default_visibility = ["//visibility:public"])

serving_cc_library(
    name = "propagator",
    srcs = ["propagator.cc"],
    hdrs = ["propagator.h"],
    deps = [
        "//secretflow_serving/core:exception",
        "//secretflow_serving/ops:graph",
        "//secretflow_serving/ops:op_kernel",
    ],
)

serving_cc_library(
    name = "executor",
    srcs = ["executor.cc"],
    hdrs = ["executor.h"],
    deps = [
        ":propagator",
        "//secretflow_serving/ops",
        "//secretflow_serving/util:thread_pool",
        "//secretflow_serving/util:thread_safe_queue",
    ],
)

serving_cc_test(
    name = "executor_test",
    srcs = ["executor_test.cc"],
    deps = [
        ":executor",
        "//secretflow_serving/util:arrow_helper",
        "//secretflow_serving/util:utils",
    ],
)

serving_cc_library(
    name = "executable",
    srcs = ["executable.cc"],
    hdrs = ["executable.h"],
    deps = [
        ":executor",
    ],
)

serving_cc_library(
    name = "model_info_collector",
    srcs = ["model_info_collector.cc"],
    hdrs = ["model_info_collector.h"],
    deps = [
        "//secretflow_serving/apis:model_service_cc_proto",
        "//secretflow_serving/core:exception",
        "//secretflow_serving/util:utils",
        "@com_github_brpc_brpc//:brpc",
    ],
)

serving_cc_library(
    name = "execute_context",
    srcs = ["execute_context.cc"],
    hdrs = ["execute_context.h"],
    deps = [
        "//secretflow_serving/apis:execution_service_cc_proto",
        "//secretflow_serving/apis:prediction_service_cc_proto",
        "//secretflow_serving/core:exception",
        "//secretflow_serving/ops:graph",
        "//secretflow_serving/server:execution_core",
        "//secretflow_serving/util:utils",
        "@com_github_brpc_brpc//:brpc",
    ],
)

serving_cc_library(
    name = "predictor",
    srcs = ["predictor.cc"],
    hdrs = ["predictor.h"],
    deps = [
        ":execute_context",
        "//secretflow_serving/apis:common_cc_proto",
        "//secretflow_serving/apis:prediction_service_cc_proto",
        "//secretflow_serving/server:execution_core",
        "//secretflow_serving/util:arrow_helper",
        "//secretflow_serving/util:utils",
        "@com_github_brpc_brpc//:brpc",
    ],
)

serving_cc_test(
    name = "predictor_test",
    srcs = ["predictor_test.cc"],
    deps = [
        ":predictor",
    ],
)

serving_cc_test(
    name = "execute_context_test",
    srcs = ["execute_context_test.cc"],
    deps = [
        ":execute_context",
    ],
)

serving_cc_library(
    name = "loader",
    hdrs = ["loader.h"],
    deps = [
        "//secretflow_serving/protos:bundle_cc_proto",
    ],
)

serving_cc_library(
    name = "model_loader",
    srcs = ["model_loader.cc"],
    hdrs = ["model_loader.h"],
    deps = [
        ":loader",
        "//secretflow_serving/util:sys_util",
        "//secretflow_serving/util:utils",
    ],
)
